package com.karaku.karaku_collector.util;

import android.os.Handler;
import android.os.Looper;

/**
 * Created by guopi on 2017/10/28 0028.
 */

public class ThreadUtil {
    public static void runOnMainThread(Runnable r) {
        if (Looper.getMainLooper().getThread().getId() == Thread.currentThread().getId()) {
            r.run();
        } else {
            new Handler(Looper.getMainLooper()).post(r);
        }
    }
}
